#include "IMILayer.h"
IMILayer *IMILayer::create()
{
    IMILayer *pRet = new IMILayer();
    if (pRet && pRet->init())
    {
        pRet->autorelease();
        return pRet;
    }
    else
    {
        CC_SAFE_DELETE(pRet);
        return NULL;
    }
}

bool IMILayer::init()
{
	if(CCLayer::init())
	{
		m_layerPos=getPosition();
		container=CCLayer::create();
		dlgContainer=CCLayer::create();
		addChild(container);
		addChild(dlgContainer);
		return true;
	}
	return false;
}


void IMILayer::setVisible(bool bVisible)
{
	CCLayer::setVisible(bVisible);
	if(bVisible==false)
	{
		CCLayer::setPosition(ccp(8000,8000));
	}else
	{
		CCLayer::setPosition(m_layerPos);
	}
}

IMILayer::~IMILayer()
{
    unregisterScriptTouchHandler();
}

void IMILayer::setPosition(const CCPoint& newPosition)
{
	CCLayer::setPosition(newPosition);
	if(newPosition.x<8000) m_layerPos=newPosition;
}